import {createReducer} from '../../../util'
import types from '../../types'
import InitState from './homeInitState'

export default createReducer(new InitState, {
    [`${types.GET_HOME_LIST}_SUCCESS`]: (state, homeList) => {
        return state.set('homeInfo', homeList);
    },
    [`${types.GET_MENU_LIST}_SUCCESS`]: (state, menuInfo) => {
        return state.set('menu', menuInfo);
    }, [`${types.GET_GOOD_LIST}_SUCCESS`]: (state, goodInfo) => {
        return state.set('good', goodInfo);
    }, [`${types.GET_GOOD_INFO_LIST}_SUCCESS`]: (state, goodInfo) => {
        return state.set('goodInfo', goodInfo);
    },
    [`${types.ADD_ORDER}_SUCCESS`]: (state, msg) => {
        return state.set('message', msg);
    },
    [`${types.GET_ORDER}_SUCCESS`]: (state, orderInfo) => {
        return state.set('order', orderInfo);
    }
})